<?php
namespace Home\Controller;
use Think\Controller;
use Think\Page;

class ServiceController extends BaseController
{
    protected $mdlCategory = null;
    protected $mdlSinglePage = null;

    public function __construct()
    {
        parent::__construct();
        $this->mdlCategory = M('Category');
        $this->mdlSinglePage = M('SinglePage_About');
    }

    public function indexAction()
    {
        //顶级栏目
        $top_cat_id = 11;
        $cat2_id = I('GET.cat2_id', 0, 'intval');
        $cat_id = I('GET.cat_id', 0, 'intval');
        $cat_list = $this->getCatList($top_cat_id);

        //具体栏目信息
        $cat_info = $this->mdlCategory->find($cat_id);
        if (2 == $cat_info['type']) {
            $condition = array(
                'cat_id' => $cat_id,
            );
            $page_info = M('SinglePage_About')->where($condition)->find();
            $global_config = array(
                'title' => $page_info['title'] . '-' . C('SITE_NAME'),
                'keywords' => $page_info['title'],
                'description' => $page_info['title'],
            );
            $this->assign('page_info', $page_info);
        }
        $this->assign('cat2_id', $cat2_id);
        $this->assign('cat_id', $cat_id);
        $this->assign('cat_list', $cat_list);
        $this->assign('global_config', $global_config);
        $this->display();
    }
}